//
//  PicCollectionViewCell.m
//  CarFace
//
//  Created by dlios on 15-3-27.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "PicCollectionViewCell.h"

@implementation PicCollectionViewCell

- (void)dealloc
{
    [_imageView release];
    [_dic release];
    [super dealloc];
    
}



- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageView = [[UIImageView alloc]init];;
//        self.imageView.backgroundColor = [UIColor purpleColor];
        [self.contentView addSubview:self.imageView];
        [_imageView release];
        
    }
    return self;
}


-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.imageView.frame = layoutAttributes.bounds;
    
    
}


-(void)setDic:(NSDictionary *)dic
{
    if (_dic !=dic) {
        [_dic release];
        _dic = [dic retain];
    }
    
    NSString *picurl = [self.dic valueForKey:@"smallpic"];
    picurl = [picurl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:picurl];
    [self.imageView setImageWithURL:url];
}

@end
